{{- if .Values.global.modules.publicDomainTemplate }}
  {{- if eq (include "helm_lib_module_https_mode" .) "CertManager" }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: dex
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "dex")) | nindent 2 }}
spec:
  certificateOwnerRef: false
  secretName: {{ include "helm_lib_module_https_secret_name" (list . "ingress-tls") }}
  {{ include "helm_lib_module_generate_common_name" (list . "dex") | nindent 2 }}
  dnsNames:
  - {{ include "helm_lib_module_public_domain" (list . "dex") }}
  issuerRef:
    name: {{ include "helm_lib_module_https_cert_manager_cluster_issuer_name" . }}
    kind: ClusterIssuer
  {{- end }}
{{- end }}
